//
//  S4UTabBarView.m
//  Service4U
//
//  Created by Hai Nguyen on 10/5/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "S4UTabBarView.h"

@implementation S4UTabBarView
@synthesize homeButton;
@synthesize mapButton;
@synthesize appointmentButton;
@synthesize backgroundImage;
@synthesize viewDelegate;

- (void) reset{
	NSLog(@"reset");
	[self.homeButton setSelected:YES];
	[self.mapButton setSelected:NO];
	[self.appointmentButton setSelected:NO];
}

- (id)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code.
    }
    return self;
}

- (IBAction)buttonPressed:(id) sender{
	UIButton *button = (UIButton*) sender;
	switch (button.tag) {
		case 1:
			[homeButton setSelected:YES];
			[mapButton setSelected:NO];
			[appointmentButton setSelected:NO];
			[self.viewDelegate pressedButtonWithTag:KHomeButtonTag];
			break;
		case 2:
			[homeButton setSelected:NO];
			[mapButton setSelected:YES];
			[appointmentButton setSelected:NO];
			[self.viewDelegate pressedButtonWithTag:KMapButtonTag];
			break;
		case 3:
			[homeButton setSelected:NO];
			[mapButton setSelected:NO];
			[appointmentButton setSelected:YES];
			[self.viewDelegate pressedButtonWithTag:KAppointmentButtonTag];
			break;
	}
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code.
}
*/

- (void)dealloc {
	[homeButton release];
	[mapButton release];
	[appointmentButton release];
	[backgroundImage release];
    [super dealloc];
}


@end
